home *** CD-ROM | disk | FTP | other *** search
- /* DisplayNameRegistry.h */
- /*
- * DisplayNameRegistry.h
- * Copyright © 1993-94 Apple Computer Inc. All rights reserved.
- */
- #ifndef __NameRegistryDisplay__
- #define __NameRegistryDisplay__
-
- #define kVersionMajor 1
- #define kVersionMinor 0
- #define kVersionStage beta /* Res only */
- #define kVersionStageLetter 'b'
- #define kVersionRelease 1
- #define kApplicationCreator 'DNPR'
- #define MBAR_MenuBar 1
- #define MENU_Apple 1
- #define MENU_File 256
- #define MENU_Edit 257
- #define MENU_Options 258
- #define MENU_FontName 259
- #define MENU_FontSize 260
- #define CNTL_FontNamePopup 256
- #define CNTL_FontSizePopup 257
- #define PICT_OnDisk 128
- #define PICT_InNVRAM 129
- #define ACUR_Animator 256
- #define LDEF_Stub 1024
- #define STRN_Options 128
- #define DLOG_About 128
- #define ALRT_NonFatalError 129
- #define ALRT_FatalError 130
- #define DLOG_SetFontInfo 256
- #define DLOG_SFPutFile 4000
- #define STR_FinderIDString (-16397) /* Resource id of help message */
-
- #ifndef REZ
- #include <ConditionalMacros.h>
- #if GENERATINGPOWERPC == 0
- << error: the following will not work >>
- #endif
- #include <Types.h>
- #include <MixedMode.h>
- #include <OSUtils.h>
- #include <Files.h>
- #include <QuickdrawText.h>
- #include <QuickDraw.h>
- #include <Events.h>
- #include <Errors.h>
- #include <Memory.h>
- #include <Menus.h>
- #include <Controls.h>
- #include <Windows.h>
- #include <TextEdit.h>
- #include <Dialogs.h>
- #include <MachineExceptions.h>
- #include <PCI.h>
- #include <Kernel.h>
- #include <NameRegistry.h>
- #include <CodeFragments.h>
- #include <Devices.h>
- #include <Fonts.h>
- #include <Resources.h>
- #include <LowMem.h>
- #include <StandardFile.h>
- #include <IntlResources.h>
- #include <Script.h>
- #include <TextUtils.h>
- #include <SegLoad.h>
- #include <FixMath.h>
- #include <ToolUtils.h>
- #include <Gestalt.h>
- #include <Printing.h>
- #include <AppleTalk.h>
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
-
- #include "AppleEventCore.h"
- #include "TwistDownList.h"
-
- /*
- *** Common definitions
- */
- #ifndef EXTERN
- #define EXTERN extern
- #endif
- #ifndef TRUE
- #define TRUE 1
- #define FALSE 0
- #endif
- #ifndef NULL
- #define NULL 0
- #endif
- #define kScrollBarWidth (16)
- #define kAnimationInterval (6) /* Ticks */
- #define kOKButton (1)
- #define kCancelButton (2)
- enum {
- kMinWindowWidth = 64,
- kMinWindowHeight = 64
- };
- #define width(rect) ((rect).right - (rect).left)
- #define height(rect) ((rect).bottom - (rect).top)
- /*
- * Parts of a rectangle
- */
- #define topLeft(rect) (((Point *) &rect)[0])
- #define botRight(rect) (((Point *) &rect)[1])
-
- /*
- * Printable characters from the ISO-Invariant character set.
- */
- #define IS_ASCII_PRINT(c) ((c) >= ' ' && (c) <= '~')
-
- enum {
- kPrimaryIndentLevel = 0,
- kSecondaryIndentLevel,
- kValueIndentLevel
- };
- #define kOneLineFormatLength (80)
- #define kSavedInNVRAM (kFirstUserFlag)
- #define kSavedOnDisk (kFirstUserFlag << 1)
-
- enum {
- kOptionFontName = 1,
- kOptionFontSize
- };
-
- #define UNUSED(what) do { \
- what; \
- } while (0)
-
- /*
- * This is used by the animated cursor subroutine.
- */
- typedef struct {
- unsigned short nFrames;
- unsigned short nextFrame;
- CursHandle frame[1];
- } ACUR_Record, *ACUR_Ptr, **ACUR_Handle;
-
- /*
- * All of the information we need for browsing is stored in an extended
- * window record.
- *
- * Each value (path : property : value) is stored in a TwistDown list element. Each
- * element contains both the property (PString) and path (C string). If there is
- * a property value, it will be stored in a sub-list. This is stored in the
- * registrySiblingSet (REG). After this set has been constructed, the list is
- * sorted and a display SiblingSet is constructed. The elements of this set contain
- * readable text.
- */
- typedef struct BrowserRecord {
- WindowRecord theWindow;
- ListHandle theList;
- unsigned long dataIndex;
- unsigned long dataSize;
- TwistDownSiblingSet registrySiblingSet;
- TwistDownSiblingSet displaySiblingSet;
- Boolean sortByName;
- short fontNumber;
- short fontSize;
- Str255 fontNameText;
- } BrowserRecord, *BrowserPtr;
- #define BROWSER (*browserPtr)
- #define REG (BROWSER.registrySiblingSet)
- #define DIS (BROWSER.displaySiblingSet)
-
- /*
- * Window management functions
- */
- OSErr MakeNameRegistryBrowserWindow(void);
- void DoRefreshDisplay(
- BrowserPtr browserPtr
- );
- void DoEnumerateNameRegistry(
- BrowserPtr browserPtr
- );
- void DisposeBrowser(
- register BrowserPtr browserPtr
- );
- void DoContentClick(
- register BrowserPtr browserPtr,
- const EventRecord *eventRecordPtr
- );
- void DoWindowKeyDown(
- register BrowserPtr browserPtr
- );
- void UpdateBrowserWindow(
- register BrowserPtr browserPtr,
- RgnHandle updateRgn
- );
- void ActivateBrowser(
- register BrowserPtr browserPtr,
- Boolean isActivating
- );
- void EnumerateNameRegistry(
- BrowserPtr browserPtr
- );
- TwistDownHdl FormatThisProperty(
- const RegPropertyNameBuf foundProperty,
- RegPropertyValueSize propertySize,
- const void *propertyValue
- );
- Boolean OneLineProperty(
- const char *labelText,
- const TwistDownHdl valueElement,
- char *oneLineWork
- );
- UInt32 UnpackDataRecord(
- const TwistDownPtr thisElement, /* Locked TwistDownHdl */
- char **pathNameCString,
- char **foundPropertyCString
- );
-
- /*
- * Rebuild/sort the list and display it.
- */
- void InitializeDisplayList(
- register BrowserPtr browserPtr
- );
- void RebuildDisplayList(
- register BrowserPtr browserPtr
- );
- void SortAndDisplayBrowserWindow(
- register BrowserPtr browserPtr
- );
- void DecorateBrowserWindow(
- register BrowserPtr browserPtr
- );
- void PrintBrowserWindow(
- register BrowserPtr browserPtr
- );
- Boolean SetFontInfoDialog(
- register BrowserPtr browserPtr
- );
- void DoSetFontInfo(
- register BrowserPtr browserPtr
- );
- pascal void DisplayListDrawProc(
- ListHandle twistDownListHdl, /* The list itself */
- TwistDownPtr twistDownPtr, /* Locked data handle */
- const Rect *viewRect /* Draw in this area */
- );
- #if 0
- pascal OSErr DisplayListPrintImageProc(
- ListHandle theList,
- THPrint hPrint,
- void *clientData,
- StringPtr dateString,
- const Rect *pageRect,
- short pageNumber
- );
- #endif
- /*
- * The TwistDownList manager calls this to draw a list element.
- */
- pascal void DrawThisElement(
- ListHandle twistDownListHdl, /* The list itself */
- TwistDownPtr twistDownPtr, /* Locked data handle */
- const Rect *viewRect /* Draw in this area */
- );
-
- /*
- * Output functions.
- */
- void CreateOutputFile(void);
-
- /*
- * Animated Cursor Utilities
- */
- void SetupAnimatedCursor(
- short ACUR_ResID
- );
- void SpinCursor(void);
- extern void pstrcpy(
- StringPtr dst,
- ConstStr255Param src
- );
- extern void pstrcat(
- StringPtr dst,
- ConstStr255Param src
- );
- /*
- * Window utilities.
- */
- void DoZoomWindow(
- WindowPtr theWindow,
- short whichPart
- );
- Boolean DoGrowWindow(
- WindowPtr theWindow,
- Point startingPoint,
- short minimumWidth,
- short minimumHeight
- );
- /*
- * Cheap 'n dirty memory clear routine.
- */
- #define Clear(dst) do { \
- Ptr _ptr = (Ptr) &dst; \
- Size _size = sizeof dst; \
- while (_size > 0) { \
- *_ptr++ = 0; \
- --_size; \
- } \
- } while (0)
-
- void CheckError(
- OSErr errorStatus,
- ConstStr255Param errorMsg
- );
- void NonFatalError(
- OSErr errorStatus,
- ConstStr255Param errorMsg
- );
- void FatalError(
- OSErr errorStatus,
- ConstStr255Param errorMsg
- );
- short ErrorMessage(
- short alertID,
- OSErr errorStatus,
- ConstStr255Param errorMsg
- );
-
- /*
- * Global values
- */
- EXTERN EventRecord gEventRecord;
- EXTERN Boolean gQuitNow;
- EXTERN Boolean gUpdateMenusNeeded;
- EXTERN BrowserPtr gCurrentBrowserPtr;
- EXTERN short gOpenWindowCount;
- EXTERN MenuHandle gAppleMenu;
- EXTERN MenuHandle gFileMenu;
- EXTERN MenuHandle gEditMenu;
- EXTERN MenuHandle gOptionMenu;
- EXTERN THPrint gPrintHandle;
- EXTERN ACUR_Handle gACUR_Handle;
- EXTERN unsigned long gACUR_NextAnimation;
- EXTERN SFReply gSFReply;
- EXTERN short gSaveFileRefNum;
- extern Boolean gSaveAllElements;
-
- #endif /* Not REZ */
- #endif /* __NameRegistryDisplay__ */
-